﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Bovril.PlayingCards.French
{
    public class SuitValue
    {
        public const int MaxValue = 3;
        public const int Clubs = 3;
        public const int Diamonds = 2;
        public const int Hearts = 1;
        public const int Spades = 0;
        public const int MinValue = 0;

        private static String[] asText_ = new String[4]
        {
            "Spades",
            "Hearts",
            "Diamonds",
            "Clubs"
        };

        public static String ToString(int rankValue)
        {
            return asText_[rankValue];
        }

        public static int FromString(String str)
        {
            for (int suit = MaxValue; suit >= MinValue; --suit)
            {
                if (asText_[suit] == str)
                    return suit;
            }

            throw new ArgumentException("Unable to lookup suit", "text");
        }

        public static String[] GetAllValuesAsStrings()
        {
            return new String[]
            {
                asText_[SuitValue.Clubs],
                asText_[SuitValue.Diamonds],
                asText_[SuitValue.Hearts],
                asText_[SuitValue.Spades]
            };
        }
    }
}
